import java.sql.*;

public class jdbc1 {
    public static void main(){
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url="jdbc:mysql://127.0.0:3306/test";
            Connection connection;
            connection = DriverManager.getConnection(url,"root","0219");
            System.out.println(connection);
            String sql="select * from student where age > ?";
            PreparedStatement ps=connection.prepareStatement(sql);
            ps.setInt(1,20);
            ResultSet resultSet=ps.executeQuery();
            while(resultSet.next()){
                String studentName=resultSet.getString("string_name");
                System.out.println(studentName);

            }
            connection.close();
            ps.close();
            resultSet.close();

        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }


    }
}
